<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <h1>键盘事件</h1>
        <label for="">姓名</label>
        <input type="text" v-on:keyup = "logName">
        <label for="">年龄</label>
        <input type="text" v-on:keyup = "logAge">
        <label for="">学校</label>
        <input type="text" v-on:keyup.enter = "enter">

        <div id="text"></div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script>
        new Vue({
            el:"#app",
            data:{
                
            },
            methods:{
                logName: function(){
                    console.log("你正在输入名字");
                    document.getElementById('text').innerHTML = "你正在输入名字";
                },
                logAge:function(){
                    console.log("你正在输入年龄");
                },
                enter: function(){
                    console.log("按enter输出的内容");
                }
            }
        })
    </script>
</body>
</html>